import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useStore = defineStore('main', () => {
  const selectedKeys = ref('dashboard')
  return { selectedKeys }
})

export const useRoleStore = defineStore('role', () => {
  let role = ref('')
  function setRole(r) {
    role.value = r
  }
  return { role, setRole }
})

export const useCounterStore = defineStore('counter', {
  state: () => {
    return { count: 0 }
  },
  // 也可以定义为
  // state: () => ({ count: 0 })
  actions: {
    increment() {
      this.count++
    },
  },
})